home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
CUJ9206.ARJ
/
1006090B
< prev
next >
Wrap
Text File
|
1992-06-02
|
656b
|
37 lines
/* LISTING 5 */
#define DM1init
#define DM1type double *
DM1init;
DM1type DM1alloc(int r, int c) {
return (double *)
malloc((unsigned)r*c*(sizeof(double)));
}
#define DM1item(x,i,j,c) x[(i)*(c)+(j)]
void DM1free(DM1type x) {
free((void *)x);
}
main()
{
DM1type m;
int i,j;
m = DM1alloc(7,13);
for(i=0; i<7; ++i)
for(j=0; j<13; ++j)
DM1item(m,i,j,13) = (double) (i*100)+j;
for(i=0; i<7; ++i) {
for(j=0; j<13; ++j)
printf("%3g ",DM1item(m,i,j,13) );
printf("\n");
}
DM1free(m);
}